In the prior art, a head of a fan can pivot left and right as well as up and down by designing independent mechanisms in horizontal and vertical directions respectively. A fan head of each of CN203717400 U, CN104204536 A, CN203730360 U and CN 203847417 U can rotate within a space by an independent automatic swing mechanism and an independent automatic pitching mechanism, however the structure is complex and the cost is high.